package top.honlnk.czuan.common.context;

import org.jetbrains.annotations.NotNull;
import top.honlnk.czuan.pojo.entity.User;

public class UserContextHolder {
    private static final ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public static void setUser(@NotNull User user) {
        userThreadLocal.set(user);
    }

    public static User getUser() {
        return userThreadLocal.get();
    }

    public static void clearUser() {
        userThreadLocal.remove();
    }
}
